<div id="tab5" class="tab">
    <div class="tab-labels">
        <div class="xian"></div>
        本车车损
    </div>
    <div style="border:1px solid #FF5722;">
        <form action="">
            <input type="hidden" name="bid" id="bid" value="{$row.id}">
            <table class="layui-table">
                <tr style="background:#4e73df;color: #fff;" class="ys">
                    <td>车牌号</td>
                    <!--<td>车辆品牌</td>-->
                    <td>车型型号</td>
                    <!--<td>车辆年款</td>-->
                    <td>车架号</td>
                    <td>发动机号</td>
                    <td>驾驶员</td>
                    <!--<td>性别</td>-->
                    <td>联系电话</td>
                    <!--<td>维修厂名称</td>-->
                </tr>
                <tr>
                    <td><input type="text" value="{$row.car_num}" readonly="readonly"></td>
                    <!--<td><input type="text" value="{$row.benche_brand}" readonly="readonly"></td>-->
                    <td><input type="text" value="{$res.car_factory_num}" readonly="readonly"></td>
                    <!--<td><input type="text" value="{$row.benche_year}" readonly="readonly"></td>-->
                    <td><input type="text" value="{$res.car_vin}" readonly="readonly"></td>
                    <td><input type="text" value="{$res.car_engine}" readonly="readonly"></td>
                    <td><input type="text" value="{$row.sj_car_ren}" readonly="readonly"></td>
                    <!--<td><input type="text" value="{$row.benche_sex}" readonly="readonly"></td>-->
                    <td><input type="text" value="{$row.phone}" readonly="readonly"></td>
                    <!--<td><input type="text" value="{$row.weixiuchang}" readonly="readonly"></td>-->
                </tr>
            </table>
            <div class="titles" style="width: 100%;height: 30px;margin: 10px 0; font-size: 14px;">
                <p><font></font>配件定损</p>
            </div>
            {if $row['status'] eq 1}
            <input type="button" onclick="hd_benche(this)" value="保存数据"
                   style="padding: 5px 10px;height:30px;border: none;background:#1b4fe7;color: #fff;">
            {/if}
            <input type="button" onclick="export_excel(1)" value="导出配件数据"
                   style="padding: 5px 10px;height:30px;border: none;background:#1b4fe7;color: #fff;">
            <table class="layui-table" id="tabProduct">
                <tr style="background:#4e73df;color: #fff;" class="ys">
                    <td></td>
                    <td>序号</td>
                    <!--<td>服务种类</td>-->
                    <td>配件名称</td>
                    <td>价格方案</td>
                    <td>价格</td>
                    <td>数量</td>
                    <td>金额</td>
                    <!-- <td>折扣</td> -->
                    <td>核定价格</td>
                    <td>核定数量</td>
                    <td>核价金额</td>
                    <!-- <td>操作员</td> -->
                    <td>备注</td>
                </tr>
                {volist name="peijian" id="peijians"}
                <tr>
                    <td><input class="hd_a_id" type="hidden" value="{$peijians.id}"></td>
                    <td><input type="text" readonly="readonly" value="{$peijians.xuhao}"></td>
                    <!--<td><input type="text" readonly="readonly" value="{$peijians.type}"></td>-->
                    <td><input type="text" readonly="readonly" value="{$peijians.name}"></td>
                    <td><input type="text" readonly="readonly" value="{$peijians.fangan}"></td>
                    <td><input type="text" readonly="readonly" value="{$peijians.price}"></td>
                    <td><input type="text" readonly="readonly" value="{$peijians.num}"></td>
                    <td><input type="text" readonly="readonly" value="{$peijians.money}"></td>
                    <!-- <td><input type="text" readonly="readonly" value="{$peijians.zhekou}"></td> -->
                    <td>
                        <input oninput="hd_jisuan()" class="hd_a_price" type="text"
                               value="{if $peijian1==1}{if $peijians.price_he>0}{$peijians.price_he}{else}{$peijians.price}{/if}{else}{$peijians.price_he}{/if}">
                    </td>
                    <td>
                        <input oninput="hd_jisuan()" class="hd_a_num" type="text"
                               value="{if $peijian1==1}{if $peijians.num_he>0}{$peijians.num_he}{else}{$peijians.num}{/if}{else}{$peijians.num_he}{/if}">
                    </td>
                    <td>
                        <input class="hd_a_hejia" type="text"
                               value="{if $peijian1==1}{if $peijians.hejia>0}{$peijians.hejia}{else}{$peijians.money}{/if}{else}{$peijians.hejia}{/if}">
                    </td>
                    <td><input class="hd_a_beizhu" type="text" value="{$peijians.beizhu}"></td>
                </tr>
                {/volist}
            </table>
            <table class="layui-table" id="he">
                <tr>
                    <td>小计</td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <!-- <td><input type="text" readonly="readonly"></td> -->
                    <td><input type="text" value="{$row.benche_heji}" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input id="hprice_he" type="text" value="{$row.benche_hejia}"
                               readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                </tr>
            </table>
        </form>
        <!--<p>汇总</p>-->
        <div class="conts">
            <div class="input">
                <span>合计</span>
                <input type="text" value="{$row.benche_heji}" readonly="readonly">
            </div>
            <div class="input">
                <span>残值</span>
                <input type="text" value="{$row.benche_canzhi}" readonly="readonly">
            </div>
            <div class="input">
                <span>总计</span>
                <input type="text" value="{$row.benche_zongji}" readonly="readonly">
            </div>
        </div>
        <div class="conts">
            <div class="input">
                <span>核定合计</span>
                <input oninput="hd_jisuan()" id="hd_a_heji" type="text" value="{$row.hd_benche_heji}">
            </div>
            <div class="input">
                <span>核定残值</span>
                <input oninput="hd_jisuan()" id="hd_a_canzhi" type="text"
                       value="<?php if($row['hd_benche_canzhi']){ echo $row['hd_benche_canzhi']; }else{ echo $row['benche_canzhi'];}?>">
            </div>
            <div class="input">
                <span>核定总计</span>
                <input id="hd_a_zongji" type="text" value="{$row.hd_benche_zongji}">
            </div>
        </div>
        <script>
            function export_excel(type) {
                // 本车使用的函数
                var bid = document.getElementById('bid').value;
                window.location.href = "export_excel?id=" + bid + "&type=" + type;
            }

            function hd_benche(sub) {
                layer.confirm('请确认是否已填完数据', {icon: 3}, function (index) {
                    var ids = $('.hd_a_id');
                    var price = $('.hd_a_price');
                    var num = $('.hd_a_num');
                    var money = $('.hd_a_hejia');
                    var beizhu = $('.hd_a_beizhu');
                    var bid = document.getElementById('bid').value;

                    var a_id = new Array();
                    var a_price = new Array();
                    var a_num = new Array();
                    var a_money = new Array();
                    var a_beizhu = new Array();

                    for (var i = 0; i < ids.length; i++) {
                        a_id[i] = ids[i].value;
                    }
                    for (var i = 0; i < price.length; i++) {
                        a_price[i] = price[i].value;
                    }
                    for (var i = 0; i < num.length; i++) {
                        a_num[i] = num[i].value;
                    }
                    for (var i = 0; i < money.length; i++) {
                        a_money[i] = money[i].value;
                    }
                    for (var i = 0; i < beizhu.length; i++) {
                        a_beizhu[i] = beizhu[i].value;
                    }

                    var hd_a_heji = $("#hd_a_heji").val();
                    var hd_a_zongji = $("#hd_a_zongji").val();
                    var hd_a_canzhi = $("#hd_a_canzhi").val();

                    $.ajax({
                        url: "{:url('bushen/hejia/hd_benches')}",
                        data: {
                            id: a_id,
                            price: a_price,
                            num: a_num,
                            money: a_money,
                            bid: bid,
                            hd_a_heji: hd_a_heji,
                            hd_a_zongji: hd_a_zongji,
                            hd_a_canzhi: hd_a_canzhi,
                            beizhu: a_beizhu
                        },
                        type: 'post',
                        dataType: 'json',
                        success: function (res) {
                            layer.msg(res.msg);
                            return false;
                        }
                    })
                });
            }

            function hd_benche1() {
                var ids = $('.hd_a_id');
                var price = $('.hd_a_price');
                var num = $('.hd_a_num');
                var money = $('.hd_a_hejia');
                var beizhu = $('.hd_a_beizhu');
                var bid = document.getElementById('bid').value;

                var a_id = new Array();
                var a_price = new Array();
                var a_num = new Array();
                var a_money = new Array();
                var a_beizhu = new Array();

                for (var i = 0; i < ids.length; i++) {
                    a_id[i] = ids[i].value;
                }
                for (var i = 0; i < price.length; i++) {
                    a_price[i] = price[i].value;
                }
                for (var i = 0; i < num.length; i++) {
                    a_num[i] = num[i].value;
                }
                for (var i = 0; i < money.length; i++) {
                    a_money[i] = money[i].value;
                }
                for (var i = 0; i < beizhu.length; i++) {
                    a_beizhu[i] = beizhu[i].value;
                }

                var hd_a_heji = $("#hd_a_heji").val();
                var hd_a_zongji = $("#hd_a_zongji").val();
                var hd_a_canzhi = $("#hd_a_canzhi").val();

                $.ajax({
                    url: "{:url('bushen/hejia/hd_benches')}",
                    data: {
                        id: a_id,
                        price: a_price,
                        num: a_num,
                        money: a_money,
                        bid: bid,
                        hd_a_heji: hd_a_heji,
                        hd_a_zongji: hd_a_zongji,
                        hd_a_canzhi: hd_a_canzhi,
                        beizhu: a_beizhu
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.code != 1) {
                            layer.msg(res.msg);
                            return false;
                        }

                    }
                })
            }

            function hd_jisuan() {
                var price = $('.hd_a_price');
                var num = $('.hd_a_num');
                var money = $('.hd_a_hejia');
                var sum = 0;
                for (var i = 0; i < price.length; i++) {
                    money[i].value = price[i].value * num[i].value;
                    sum += price[i].value * num[i].value;
                }
                $("#hprice_he").val(sum.toFixed(2));
                $("#hd_a_heji").val(sum.toFixed(2));
                var hd_a_canzhi = $("#hd_a_canzhi").val();
                var hd_a_zongji = sum - Number(hd_a_canzhi);
                if (!isNaN(hd_a_zongji)) {
                    $("#hd_a_zongji").val(hd_a_zongji);
                }
            }

            hd_jisuan();
        </script>
        <div class="titles">
            <p><font></font>本车工时核定</p>
        </div>
        <form action="">
            {if $row['status'] eq 1}
            <input type="button" onclick="hd_bengong(this)" value="保存数据"
                   style="padding: 5px 10px;height:30px;border: none;background:#1b4fe7;color: #fff;">
            {/if}
            <input type="button" onclick="export_excel(2)" value="导出工时数据"
                   style="padding: 5px 10px;height:30px;border: none;background:#1b4fe7;color: #fff;">
            <table class="layui-table" id="tabProduct1">
                <tr style="background:#4e73df;color: #fff;" class="ys">
                    <td></td>
                    <td>序号</td>
                    <!--<td>服务种类</td>-->
                    <td>配件名称</td>
                    <td>价格方案</td>
                    <td>价格</td>
                    <td>数量</td>
                    <td>金额</td>
                    <td>核定价格</td>
                    <td>核定数量</td>
                    <td>核价金额</td>
                    <!-- <td>操作员</td> -->
                    <td>备注</td>
                </tr>
                {volist name="bengong" id="bengongs"}
                <tr>
                    <td><input class="hd_b_id" type="hidden" value="{$bengongs.id}"></td>
                    <td><input type="text" readonly="readonly" value="{$bengongs.xuhao}"></td>
                    <td><input type="text" readonly="readonly" value="{$bengongs.name}"></td>
                    <td><input type="text" readonly="readonly" value="{$bengongs.fangan}"></td>
                    <td><input type="text" readonly="readonly" value="{$bengongs.price}"></td>
                    <td><input type="text" readonly="readonly" value="{$bengongs.num}"></td>
                    <td><input type="text" readonly="readonly" value="{$bengongs.money}"></td>
                    <td><input class="hd_b_price" oninput="hd_jisuan2()" type="text"
                               value="{if $bengong1==1}{if $bengongs.price_he>0}{$bengongs.price_he}{else}{$bengongs.price}{/if}{else}{$bengongs.price_he}{/if}">
                    </td>
                    <td><input class="hd_b_num" oninput="hd_jisuan2()" type="text"
                               value="{if $bengong1==1}{if $bengongs.num_he>0}{$bengongs.num_he}{else}{$bengongs.num}{/if}{else}{$bengongs.num_he}{/if}">
                    </td>
                    <td><input class="hd_b_hejia" type="text"
                               value="{if $bengong1==1}{if $bengongs.hejia>0}{$bengongs.hejia}{else}{$bengongs.money}{/if}{else}{$bengongs.hejia}{/if}">
                    </td>
                    <td><input class="hd_b_beizhu" type="text" value="{$bengongs.beizhu}"></td>
                </tr>
                {/volist}
            </table>
            <table class="layui-table" id="he1">
                <tr>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text"
                               value="<?php echo floatval($row['bengong_zongji'])-floatval($row['bengong_shijiu']);?>"
                               readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                    <td><input id="hd_b_money" type="text" value="{$row.bengong_hejia}"
                               readonly="readonly"></td>
                    <td><input type="text" readonly="readonly"></td>
                </tr>
            </table>
        </form>
        <!--<p>合计</p>-->
        <div class="conts">
            <div class="input">
                <span>施救费</span>
                <input type="text" value="{$row.bengong_shijiu}" readonly="readonly">
            </div>
            <div class="input">
                <span>总计</span>
                <input type="text" value="{$row.bengong_zongji}" readonly="readonly">
            </div>
        </div>
        <div class="conts">
            <div class="input">
                <span>核定施救费</span>
                <input oninput="hd_jisuan2()" id="hd_b_shijiu" type="text" value="{$row.hd_bengong_shijiu}">
            </div>
            <div class="input">
                <span>核定总计</span>
                <input id="hd_b_zongji" type="text" value="{$row.hd_bengong_zongji}">
            </div>
        </div>
        <div class="conts" style="display: none">
            <div class="input">
                <span>费用合计</span>
                <input type="text" readonly value="{$row.bc_heji}" name="bc_heji">
            </div>
        </div>
        <hr>
        <div class="conts">
            <span style="width:98%;margin: 1%;">备注说明</span>
            <textarea readonly name="dong_beizhu" cols="30" rows="10"
                      style="width:98%;height: 100px;margin: 1%;">{$row.dong_beizhu}</textarea>
        </div>
        <hr>
        <div class="conts">
            <span style="width:98%;margin: 1%;">审核意见</span>
            <textarea name="" id="chesun_1_text" cols="30" rows="10"
                      style="width:98%;height: 100px;margin: 1%;"></textarea>
        </div>
        <div style="padding: 10px;display: flex;justify-content: center;">
            {php}
            $chesun_arr=['未录入','未审核','待修改','已通过'];
            {/php}

            <button type="button" class="layui-btn layui-btn-danger yuan" id="chesun_1" >本车定损通过审核</button>
            <button type="button" class="layui-btn layui-btn-warm yuan" id="chesun_bk1">退回</button>


        </div>
        <script>
            function hd_bengong(sub) {
                layer.confirm('请确认是否已填完数据',
                    {
                        icon: 3
                    }, function (index) {
                        var ids = $('.hd_b_id');
                        var price = $('.hd_b_price');
                        var num = $('.hd_b_num');
                        var money = $('.hd_b_hejia');
                        var beizhu = $('.hd_b_beizhu');
                        var bid = document.getElementById('bid').value;

                        var b_id = new Array();
                        var b_price = new Array();
                        var b_num = new Array();
                        var b_money = new Array();
                        var b_beizhu = new Array();

                        for (var i = 0; i < ids.length; i++) {
                            b_id[i] = ids[i].value;
                        }
                        for (var i = 0; i < price.length; i++) {
                            b_price[i] = price[i].value;
                        }
                        for (var i = 0; i < num.length; i++) {
                            b_num[i] = num[i].value;
                        }
                        for (var i = 0; i < money.length; i++) {
                            b_money[i] = money[i].value;
                        }
                        for (var i = 0; i < beizhu.length; i++) {
                            b_beizhu[i] = beizhu[i].value;
                        }

                        var hd_b_zongji = $("#hd_b_zongji").val();
                        var hd_b_shijiu = $("#hd_b_shijiu").val();

                        $.ajax({
                            url: "{:url('bushen/hejia/hd_bengongs')}",
                            data: {
                                id: b_id,
                                price: b_price,
                                num: b_num,
                                money: b_money,
                                bid: bid,
                                hd_b_zongji: hd_b_zongji,
                                hd_b_shijiu: hd_b_shijiu,
                                beizhu: b_beizhu
                            },
                            type: 'post',
                            dataType: 'json',
                            success: function (res) {
                                layer.msg(res.msg);
                                return false;
                            }
                        })
                    });
            }

            function hd_bengong1() {

                var ids = $('.hd_b_id');
                var price = $('.hd_b_price');
                var num = $('.hd_b_num');
                var money = $('.hd_b_hejia');
                var beizhu = $('.hd_b_beizhu');
                var bid = document.getElementById('bid').value;

                var b_id = new Array();
                var b_price = new Array();
                var b_num = new Array();
                var b_money = new Array();
                var b_beizhu = new Array();

                for (var i = 0; i < ids.length; i++) {
                    b_id[i] = ids[i].value;
                }
                for (var i = 0; i < price.length; i++) {
                    b_price[i] = price[i].value;
                }
                for (var i = 0; i < num.length; i++) {
                    b_num[i] = num[i].value;
                }
                for (var i = 0; i < money.length; i++) {
                    b_money[i] = money[i].value;
                }
                for (var i = 0; i < beizhu.length; i++) {
                    b_beizhu[i] = beizhu[i].value;
                }

                var hd_b_zongji = $("#hd_b_zongji").val();
                var hd_b_shijiu = $("#hd_b_shijiu").val();

                $.ajax({
                    url: "{:url('bushen/hejia/hd_bengongs')}",
                    data: {
                        id: b_id,
                        price: b_price,
                        num: b_num,
                        money: b_money,
                        bid: bid,
                        hd_b_zongji: hd_b_zongji,
                        hd_b_shijiu: hd_b_shijiu,
                        beizhu: b_beizhu
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.code != 1) {
                            layer.msg(res.msg);
                            return false;
                        }

                    }
                })
            }

            function hd_jisuan2() {
                var price = $('.hd_b_price');
                var num = $('.hd_b_num');
                var money = $('.hd_b_hejia');
                var sum = 0;
                for (var i = 0; i < price.length; i++) {
                    money[i].value = price[i].value * num[i].value;
                    sum += price[i].value * num[i].value;
                }
                $("#hd_b_money").val(sum.toFixed(2));
                var hd_b_shijiu = $("#hd_b_shijiu").val();
                var hd_b_zongji = sum + Number(hd_b_shijiu);
                if (!isNaN(hd_b_zongji)) {
                    $("#hd_b_zongji").val(hd_b_zongji);
                }
            }

            hd_jisuan2();
        </script>
        <script>
            $('#chesun_1').click(function () {
                var chesun_1_text = $('#chesun_1_text').val();
                if (chesun_1_text == '') {
                    layer.msg("请输入审核原因");
                    return false
                }
                layer.confirm('确定审核？', {icon: 3, title: $(this).text()}, function (index) {

                    peijiandingsun();
                    gongshiheding();
                    $.ajax({
                        url: "{:url('bushen/hejia/shenhe_post')}",
                        data: {
                            id: "{$orderid}",
                            bid: "{$bid}",
                            chesun_1: 3,
                            tuihui: chesun_1_text,
                        },
                        type: 'post',
                        dataType: 'json',
                        success: function (res) {
                            if (res.code == 1) {
                                layer.msg(res.msg, {time: 2000}, function () {
                                    layer.closeAll()
                                    parent.layer.closeAll();
                                    parent.$("#table").bootstrapTable('refresh', {});
                                });
                            } else {
                                layer.msg(res.msg);
                            }
                        }
                    })
                    layer.close(index);
                });

            })

            //配件定损保存数据
            function peijiandingsun() {
                var ids = $('.hd_a_id');
                var price = $('.hd_a_price');
                var num = $('.hd_a_num');
                var money = $('.hd_a_hejia');
                var beizhu = $('.hd_a_beizhu');
                var bid = document.getElementById('bid').value;

                var a_id = new Array();
                var a_price = new Array();
                var a_num = new Array();
                var a_money = new Array();
                var a_beizhu = new Array();

                for (var i = 0; i < ids.length; i++) {
                    a_id[i] = ids[i].value;
                }
                for (var i = 0; i < price.length; i++) {
                    a_price[i] = price[i].value;
                }
                for (var i = 0; i < num.length; i++) {
                    a_num[i] = num[i].value;
                }
                for (var i = 0; i < money.length; i++) {
                    a_money[i] = money[i].value;
                }
                for (var i = 0; i < beizhu.length; i++) {
                    a_beizhu[i] = beizhu[i].value;
                }

                var hd_a_heji = $("#hd_a_heji").val();
                var hd_a_zongji = $("#hd_a_zongji").val();
                var hd_a_canzhi = $("#hd_a_canzhi").val();

                $.ajax({
                    url: "{:url('bushen/hejia/hd_benches')}",
                    data: {
                        id: a_id,
                        price: a_price,
                        num: a_num,
                        money: a_money,
                        bid: bid,
                        hd_a_heji: hd_a_heji,
                        hd_a_zongji: hd_a_zongji,
                        hd_a_canzhi: hd_a_canzhi,
                        beizhu: a_beizhu
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        // layer.msg(res.msg);return false;
                    }
                })
            }

            //本车工时核定
            function gongshiheding() {
                var ids = $('.hd_b_id');
                var price = $('.hd_b_price');
                var num = $('.hd_b_num');
                var money = $('.hd_b_hejia');
                var beizhu = $('.hd_b_beizhu');
                var bid = {$orderid};

                var b_id = new Array();
                var b_price = new Array();
                var b_num = new Array();
                var b_money = new Array();
                var b_beizhu = new Array();

                for (var i = 0; i < ids.length; i++) {
                    b_id[i] = ids[i].value;
                }
                for (var i = 0; i < price.length; i++) {
                    b_price[i] = price[i].value;
                }
                for (var i = 0; i < num.length; i++) {
                    b_num[i] = num[i].value;
                }
                for (var i = 0; i < money.length; i++) {
                    b_money[i] = money[i].value;
                }
                for (var i = 0; i < beizhu.length; i++) {
                    b_beizhu[i] = beizhu[i].value;
                }

                var hd_b_zongji = $("#hd_b_zongji").val();
                var hd_b_shijiu = $("#hd_b_shijiu").val();

                $.ajax({
                    url: "{:url('bushen/hejia/hd_bengongs')}",
                    data: {
                        id: b_id,
                        price: b_price,
                        num: b_num,
                        money: b_money,
                        bid: bid,
                        hd_b_zongji: hd_b_zongji,
                        hd_b_shijiu: hd_b_shijiu,
                        beizhu: b_beizhu
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        // layer.msg(res.msg);return false;
                    }
                })
            }

            $('#chesun_11').click(function () {
                layer.confirm('确定' + $(this).text() + '？', {
                    icon: 3,
                    title: $(this).text()
                }, function (index) {
                    $.ajax({
                        url: "{:url('bshenhe/shenhe_post')}",
                        data: {
                            id: "{$orderid}",
                            bid: "{$bid}",
                            chesun_1: 3,
                            tuihui: $('#chesun_1_text').val(),
                        },
                        type: 'post',
                        dataType: 'json',
                        success: function (res) {
                            layer.close(index);
                            layer.msg(res.msg);
                            if (res.code == 1) {
                                window.location.href = 'fenxiang';
                            }
                            //  $('#chesun_1').hide();
                            //  $('#chesun_bk1').hide();
                        }
                    })
                });

            })
            $('#chesun_12').click(function () {
                layer.confirm('确定' + $(this).text() + '？', {
                    icon: 3,
                    title: $(this).text()
                }, function (index) {
                    $.ajax({
                        url: "{:url('bshenhe/shenhe_post')}",
                        data: {
                            id: "{$orderid}",
                            bid: "{$bid}",
                            chesun_1: 3,
                            tuihui: $('#chesun_1_text').val(),
                        },
                        type: 'post',
                        dataType: 'json',
                        success: function (res) {
                            layer.close(index);
                            layer.msg(res.msg);
                            if (res.code == 1) {
                                window.location.href = 'fenxiang';
                            }
                            //  $('#chesun_1').hide();
                            //  $('#chesun_bk1').hide();
                        }
                    })
                });
            })
            $('#chesun_13').click(function () {
                layer.confirm('确定' + $(this).text() + '？', {
                    icon: 3,
                    title: $(this).text()
                }, function (index) {
                    $.ajax({
                        url: "{:url('bshenhe/shenhe_post')}",
                        data: {
                            id: "{$orderid}",
                            bid: "{$bid}",
                            chesun_1: 3,
                            tuihui: $('#chesun_1_text').val(),
                        },
                        type: 'post',
                        dataType: 'json',
                        success: function (res) {
                            layer.close(index);
                            layer.msg(res.msg);
                            if (res.code == 1) {
                                window.location.href = 'fenxiang';
                            }
                            //  $('#chesun_1').hide();
                            //  $('#chesun_bk1').hide();
                        }
                    });
                });
            })
            $('#chesun_bk1').click(function () {
                var chesun_1_text = $('#chesun_1_text').val();
                if (chesun_1_text == '') {
                    layer.msg("请输入审核原因");
                    return false
                }
                layer.confirm('确定' + $(this).text() + '？', {
                    icon: 3,
                    title: $(this).text()
                }, function (index) {
                    $.ajax({
                        url: "{:url('bushen/hejia/shenhe_post')}",
                        data: {
                            id: "{$orderid}",
                            bid: "{$bid}",
                            chesun_1: 2,
                            tuihui: chesun_1_text,
                        },
                        type: 'post',
                        dataType: 'json',
                        success: function (res) {
                            if (res.code == 1) {
                                layer.msg(res.msg, {time: 2000}, function () {
                                    layer.closeAll()
                                    parent.layer.closeAll();
                                    parent.$("#table").bootstrapTable('refresh', {});
                                });
                            } else {
                                layer.msg(res.msg);
                            }
                        }
                    });
                });
            })
        </script>
    </div>
</div>